<template>
  <div>
    <span class="txt-content" v-html="checkoutURL(item.content)" v-if="item.content_type != 6"></span>
    <video
      v-if="item.content_type == 6"
      :src="item.content"
      height="200px"
      x5-video-player-type="h5"
      controls
      x5-video-player-fullscreen="true"
    ></video>
  </div>
</template>
<script>
export default {
  props: ["item"],
  mounted() {
    this.$emit("loaded");
  },
  methods: {
    checkoutURL(str){
      // 要以http 开头  防止图片src开头
      let reg = /^(http:\/\/|https:\/\/)((\w|=|\?|\.|\/|&|-|#|;|%)+)/g;
      str = str.replace(reg, (website)=>{
        return "<span onclick='event.stopPropagation ? event.stopPropagation() : (event.cancelBubble = true); // 阻止事件冒泡'><a class='article-link-color' href='" + website +"' target='_blank'>" + website + "</a></span>";
      });
      return str;
    },
  }
};
</script>

<style>
.txt-content {
  user-select: text;
}

.txt-content img {
  max-width: 100%;
}

.txt-content a {
  color: #31e7c5;
}
</style>